package com.mdinfo.system.param;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/30.
 */
public class MemberParam {

    @Data
    public static class AddParam{
        @NotNull(message = "不能为空")
        @Length(min = 4,max = 12,message = "长度为4-12")
        private String username;

        @NotNull(message = "不能为空")
        @Length(min = 6,max = 12,message = "长度为6-12")
        private String password;

        @NotNull(message = "不能为空")
        @Min(value = 1, message = "最小值为1")
        private Integer deptId;

        @NotNull(message = "不能为空")
        @Min(value = 1, message = "最小值为1")
        private Integer empId;
    }

    @Data
    public static class ListQueryParam{
        @NotNull(message = "不能为空")
        @Min(value = 0,message = "最小值为0")
        private Integer start;

        @NotNull(message = "不能为空")
        @Range(min = 1,max = 50,message = "大小为1-50")
        private Integer num;
        private Integer deptId;
        private String key;
    }

    @Data
    public static class ModifyParam{
        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer memberId;
        @NotNull(message = "不能为空")
        @Range(min = 0,max = 1,message = "只能是0或1")
        private Integer usable;
        private List<Integer> roleIdList = new ArrayList<>();
    }

    @Data
    public static class LoginParam{
        @NotNull(message = "不能为空")
        @Length(min = 4,max = 12,message = "长度为4-12")
        private String username;

        @NotNull(message = "不能为空")
        @Length(min = 6,max = 12,message = "长度为6-12")
        private String password;

        @NotNull(message = "不能为空")
        private String deviceType;
        private String deviceId;
    }

    @Data
    public static class ChangePassParam{
        @NotNull(message = "不能为空")
        private Integer memberId;

        @NotNull(message = "不能为空")
        @Length(min = 6,max = 12,message = "长度为6-12")
        private String oldPass;

        @NotNull(message = "不能为空")
        @Length(min = 6,max = 12,message = "长度为6-12")
        private String newPass;
    }
}
